#include"Heap.h"

void HPTest1()
{
	HP h;
	HeapInit(&h);
	HeapPrint(&h);

	HeapPush(&h, 23);
	HeapPush(&h, 7);
	HeapPush(&h, 54);
	HeapPush(&h, 101);
	HeapPush(&h, 12);
	HeapPush(&h, 2);
	HeapPush(&h, 16);
	HeapPush(&h, 22);
	HeapPush(&h, 1);
	HeapPush(&h, 155);
	HeapPush(&h, 100);

	HeapPrint(&h);

	HeapPop(&h);
	HeapPrint(&h);

	HeapPop(&h);
	HeapPrint(&h);

	HeapPop(&h);
	HeapPrint(&h);

	HeapDestroy(&h);
}

void HPTest2()
{
	HP hp;
	HeapInit(&hp);
	HeapPush(&hp, 4);
	HeapPush(&hp, 18);
	HeapPush(&hp, 42);
	HeapPush(&hp, 12);
	HeapPush(&hp, 21);
	HeapPush(&hp, 3);
	HeapPush(&hp, 5);
	HeapPush(&hp, 5);
	HeapPush(&hp, 50);
	HeapPush(&hp, 5);
	HeapPush(&hp, 5);
	HeapPush(&hp, 15);
	HeapPush(&hp, 5);
	HeapPush(&hp, 45);
	HeapPush(&hp, 5);

	int k = 0;
	scanf_s("%d", &k);
	while (!HeapEmpty(&hp) && k--)
	{
		printf("%d ", HeapTop(&hp));
		HeapPop(&hp);
	}
	printf("\n");
}

int main()
{
	HPTest1();
	//HPTest2();
	return 0;
}